/**
 * @author: 野狼上校
 * @create: 2024-03-28 23:31
 * @version: 1.0
 *
 * 资源相关的请求
 */

import instance, {RespResult} from "@/api/index.ts"

/*查询资源数据*/
export const getResources = (data: any): Promise<RespResult> => {
    return instance({
        url: `/auth/resource/getResources`,
        method: "get",
        params: data
    })
}

/*根据Id删除*/
export const deleteResourceById = (id: number): Promise<RespResult> => {
    return instance({
        url: `/auth/resource/${id}`,
        method: "delete"
    })
}

/*新增*/
export const addResource = (data: any): Promise<RespResult> => {
    return instance({
        url: `/auth/resource`,
        method: "post",
        data: data
    })
}

/*修改*/
export const editResource = (data: any): Promise<RespResult> => {
    return instance({
        url: `/auth/resource`,
        method: "put",
        data: data
    })
}

/*根据roleId获取Resources*/
export const getResourcesByRoleId = (data: any): Promise<RespResult> => {
    return instance({
        url: `/auth/resource/getResourcesByRoleId`,
        method: "get",
        params: data
    })
}